define([ 'backbone',
         'components/pop/base',
         'text!components/pop/templates/delete.html',
         'core/utils' ],
function( Backbone, Base, template, utils ) {
    return Base.extend({
        template: _.template(template),
        className: 'popover right',
        events: {
            'click .js-btn-cancel': 'hide',
            'click .js-btn-confirm': 'triggerCallback'
        },
        isShow: function() {
            var display = this.$el.css('display');
            return display === 'none' ? false : true;
        },
        positioning: function() {
            var position = this.target.offset();
            var demension = {
                height: this.target.outerHeight(),
                width: this.target.outerWidth()
            }
            var self = {
                height: this.$el.outerHeight(),
                width: this.$el.outerWidth()
            };
            //console.log(self, demension);
            this.$el.css({
                'display': 'block',
                'left': position.left + 80,
                'top': position.top - self.height / 2 + demension.height / 2
            });
        },
        reset: function(obj) {
            var callback = obj.callback,
                target = obj.target,
                trigger = obj.trigger;

            this.setCallback(callback);
            this.setTarget(target);
            this.setTrigger(trigger);
            this.positioning();
            this.show();
        },
        triggerCallback: function() {
            this.callback.call(this);
            this.hide();
        }
    });
});
